Report post

What is the difference between appendChild and append jQuery?

The bottom is using a library (e.g. the commonly referenced jQuery), the top is using "native" DOM methods to append the element. The main difference is that appendChild is a DOM method and append is a jQuery method. The second one uses the first as you can see on jQuery source code return this.domManip(arguments, true, function( elem ) {

Is appendChild a Dom method?

yes appendChild is a DOM method and append is JQuery method but practically the key difference is that appendChild takes a node as a parameter by that I mean if you want to add an empty paragraph to the DOM you need to create that p element first

Is it safe to use appendChild in jQuery?

this.appendChild( elem ); }); If you're using jQuery library on your project, you'll be safe always using append when adding elements to the page. Do you know why append is "safe" and appendChild is not? What does domManip do?

The World's Leading Crypto Trading Platform

Get my welcome gifts